<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CreateUpdateUser.ascx.cs"
    Inherits="TVT.UI.UserControls.CreateUpdateUser" %>
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="DatePicker.ascx" TagName="DatePicker" TagPrefix="uc1" %>
<asp:UpdatePanel ID="updateUsersPanel" runat="server" UpdateMode="Conditional">
    <contenttemplate>
        <table style="text-align:left;" width="100%" cellpadding="0" cellspacing="0" >
            <tr>
                <td class="style2" style="background-image:url(App_Themes/NewDesign/Images/barra-pix.gif);">
                    <img id="imgPoints" src="App_Themes/NewDesign/Images/tild-tit.gif" style="vertical-align:middle"/>
                    <font class="titleText">User</font>
                </td>
                <td class="style2" align="right"  style="background-image:url(App_Themes/NewDesign/Images/barra-pix.gif);">    
                    <asp:LinkButton ID="lnkBtnCollapseExpand" runat="server"><asp:Image ID="imgCollapseExpand" ImageUrl="~/App_Themes/NewDesign/Images/_icon.gif" runat="server" style="padding-right:10px;vertical-align:middle;" /></asp:LinkButton>
                </td>
            </tr>
        </table>
    <asp:Panel ID="pnlCreateUpdateUser" runat="server" style="text-align:left; padding-left:45px; padding-top:10px">
        <table class="Table" width="1010px">  
          <tr>
                <td>
                    <table>
                        <tr>
                            <td colspan="2">
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="CreateUserWizard1" CssClass="transactionResultMessage"/>
                                <asp:Label ID="lblMessage" runat="server" Visible="false" CssClass="transactionResultMessage"></asp:Label>
                            </td>                        
                        </tr>
                        <tr>
                            <td align="left" style="width:80px;">
                                <asp:Label ID="lblFirstName" runat="server" CssClass="labelText" Text="First name:"></asp:Label>
                            </td>
                            <td style="text-align:left">                  
                                <asp:TextBox ID="txtFirstName" Width="140px" Height="18px" CssClass="TextBox" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFirstName"
                                    ErrorMessage="You haven't specified a First Name" ToolTip=""
                                    ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                            </td>
                           
                        </tr>
                        <tr>
                            <td align="left">
                                <asp:Label ID="lblLastName" runat="server" CssClass="labelText" Text="Last name:"></asp:Label>
                            </td>                
                            <td style="width: 160px">
                                <asp:TextBox ID="txtLastName" runat="server" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtLastName"
                                    ErrorMessage="You haven't specified a Last Name" ToolTip=""
                                    ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                            </td>
                        </tr>                                
                        <tr>
                            <td align="left">
                                <asp:Label ID="lblEmail" runat="server" Text="Email:" CssClass="labelText"></asp:Label>
                            </td>                
                            <td style="width: 160px">
                                <asp:TextBox ID="Email" runat="server" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email"
                                    ErrorMessage="You haven't specified an Email" ToolTip=""
                                    ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator id="RegExpEmail" runat="server"
                                    ValidationGroup="CreateUserWizard1"
                                    ControlToValidate="Email"
                                    ValidationExpression=".*@.*\..*"
                                    ErrorMessage="Your entry is not a valid e-mail address.">*
                                </asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                <asp:Label ID="lblIM" runat="server" Text="IM:" CssClass="labelText"></asp:Label>
                            </td>                
                            <td style="width: 160px">
                                <asp:TextBox ID="txtIM" runat="server" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>                    
                            </td>
                        </tr>    
                        <tr>
                            <td align="left">
                                <asp:Label ID="lblPhone1" runat="server" Text="Phone1:" CssClass="labelText"></asp:Label>
                            </td>                
                            <td style="width: 140px">
                                <asp:TextBox ID="txtPhone1" runat="server" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>                            
                            </td>
                        </tr> 
                        <tr>
                            <td align="left">
                                <asp:Label ID="lblHigh" runat="server" Text="High(cm):" CssClass="labelText"></asp:Label>
                            </td>                
                            <td style="width: 140px">
                                <asp:TextBox ID="txtHigh" runat="server" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>                            
                            </td>
                        </tr>  
                         <tr>
                            <td align="left">
                                <asp:Label ID="lblWeight" runat="server" Text="Weight(Kg):" CssClass="labelText"></asp:Label>
                            </td>                
                            <td style="width: 140px">
                                <asp:TextBox ID="txtWeight" runat="server" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>                            
                            </td>
                        </tr>
                        <tr>  
                            <td align="left">
                                <asp:Label ID="lblSex" runat="server" Text="Sex:" CssClass="labelText"></asp:Label>
                            </td>              
                            <td style="width: 140px">
                                <asp:RadioButtonList ID="rblSex" runat="server" Width="140px" Height="18px" RepeatDirection="Horizontal">
                                    <asp:listitem id="female" runat="server" value="female" Selected="True"/>
                                    <asp:listitem id="male" runat="server" value="male" />
                                </asp:RadioButtonList>                            
                            </td>
                        </tr>
                        <tr>  
                            <td align="left">
                                <asp:Label ID="lblLookingFor" runat="server" Text="Looking for:" CssClass="labelText"></asp:Label>
                            </td>              
                            <td style="width: 140px">
                                <asp:RadioButtonList ID="rblLookingFor" runat="server" Width="140px" Height="18px" RepeatDirection="Horizontal">
                                    <asp:listitem id="LikeFemale" runat="server" value="female" />
                                    <asp:listitem id="LikeMale" runat="server" value="male" Selected="True"/>
                                    <asp:listitem id="any" runat="server" value="any" />
                                </asp:RadioButtonList>                            
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                <uc1:DatePicker id="dpBirthDate" runat="server" Title="Birth Date:                     ">
                                </uc1:DatePicker>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                <asp:Label ID="lblUserName" runat="server" Text="Username:" CssClass="labelText"></asp:Label></td>                
                            <td style="width: 160px">
                                <asp:TextBox ID="UserName" runat="server" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                    ErrorMessage="You haven't specified an Username" ToolTip=""
                                    ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                            </td>
                        </tr>                              
                        <asp:UpdatePanel ID="pnlChangePassword" Runat="server" UpdateMode="Always">
                                <ContentTemplate>
                                <div id="divChangePassword" runat="server" visible="false">
                                    <tr>
                                    <td>
                                        <asp:Label ID="lblChangePassword" runat="server" Text="Change Password:"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="cbxChangePassword" runat="server" AutoPostBack="true" OnCheckedChanged="ChangePassword"  />
                                    </td>
                                </tr>
                                </div>
                                <div id="divOldPassword" runat="server" visible="false">            
                                    <tr>                    
                                        <td align="left">
                                            <asp:Label ID="lblOldPassword" runat="server" Text="Old Password:" CssClass="labelText"></asp:Label></td>                
                                        <td style="width: 160px">
                                            <asp:TextBox ID="txtOldPassword" runat="server" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="OldPasswprdRequired" runat="server" ControlToValidate="txtOldPassword"
                                                ErrorMessage="You have to specified you Password" ToolTip=""
                                                ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                 </div>    
                                   <div id="divNewPassword" runat="server">            
                                        <tr>
                                            <td align="left">
                                                <asp:Label ID="lblPassword" runat="server" Text="Password:" CssClass="labelText"></asp:Label></td>                
                                            <td style="width: 160px">
                                                <asp:TextBox ID="Password" runat="server" TextMode="Password" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                                    ErrorMessage="You haven't specified a Password" ToolTip=""
                                                    ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                                    
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                <asp:Label ID="lblConfirmPassword" runat="server" CssClass="labelText" Text="Confirm password:"></asp:Label></td>                
                                            <td style="width: 160px">
                                                <asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password" Width="140px" Height="18px" CssClass="TextBox"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server" ControlToValidate="ConfirmPassword"
                                                    ErrorMessage="You haven't specified a Confirmation Password" ToolTip=""
                                                    ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>                           
                                            </td>
                                        </tr>            
                                   </div>
                                 </ContentTemplate>
                            </asp:UpdatePanel>
                        <tr>
                            <td align="left">
                                <asp:Label ID="lblRole" runat="server" Text="Rol:" CssClass="labelText"></asp:Label></td>                
                            <td>
                                <asp:DropDownList Width="145px" ID="ddlRoles" runat="server" AutoPostBack="true"
                                    OnSelectedIndexChanged="ddlRoles_SelectedIndexChanged" Height="20px" CssClass="TextBox"></asp:DropDownList>                            
                            </td>
                        </tr>
                        
                                              
                        <tr>
                            <td align="center" colspan="2" style="height: 21px">
                                <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password"
                                    ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="The password doesn't match with the confirmation"
                                    ValidationGroup="CreateUserWizard1"></asp:CompareValidator>
                            </td>
                        </tr>
                        <tr>
                            <td align="center" colspan="2" style="color: red">
                                <asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
                            </td>
                        </tr>                    
                    </table>                
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table> 
        
        <%--USER ALIAS PANEL--%>
            <asp:Panel ID="pnlUserAlias" Visible="true" runat="server">
                <ContentTemplate>
                    <table id="usrAliasTable" width="1010px" runat="server" class="Table" style="margin-top: 10px">
                        <tr>
                            <td colspan="2" style="padding-left: 5px;">
                                <asp:Label ID="lblUsrAliasTitle" Text="Platform User Alias Configuration" runat="server"
                                    CssClass="labelTitleText"></asp:Label>
                            </td>
                        </tr>
                        <tr style="height: 5px">
                        </tr>
                        <tr>
                            <td style="width: 145px; padding-left: 5px;">
                                <asp:Label ID="lblUsrNamePlat" Style="width: 100px" runat="server" Text="Platform: "
                                    CssClass="labelText" Width="100px"></asp:Label>
                            </td>
                            <td style="width: 750px;">
                                <asp:DropDownList runat="server" ID="ddlUsrNamePlatform" CssClass="labelText" Width="103px">
                                    <asp:ListItem Value="Facebook" Text="Facebook" Selected="True"></asp:ListItem>
                                    <asp:ListItem Value="Tweeter" Text="Tweeter"></asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left: 5px;">
                                <asp:Label ID="lblUsrName" Style="width: 100px" runat="server" Text="User Name: "
                                    CssClass="labelText" Width="100px"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtUsrName" runat="server" Width="100px" CssClass="TextBox"></asp:TextBox>
                            </td>
                        </tr>
                        <tr style="height: 10px">
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td valign="top" align="left">
                                <asp:Button ID="btnAddUsrAlias" runat="server" Style="background-image: url(App_Themes/NewDesign/Images/btn-add.gif);
                                    cursor: pointer" CssClass="ButtonAdd" Text="Add" OnClick="AddUsrName"></asp:Button>
                                <asp:Button ID="btnCancelAddUsrName" runat="server" Style="background-image: url(App_Themes/NewDesign/Images/btn-add.gif);
                                    cursor: pointer" CssClass="ButtonAdd" Text="Cancel" OnClick="CancelAddUsrName">
                                </asp:Button>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:Label ID="lblUsrNameMessage" runat="server" Visible="false" CssClass="transactionResultMessage"></asp:Label>
                            </td>
                        </tr>
                        <tr style="height: 10px">
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="padding-left: 7px;">
                                <asp:GridView BorderStyle="None" ShowFooter="true" ID="gvUsrName" runat="server"
                                    AutoGenerateColumns="False" AllowPaging="False" OnRowCommand="gvUsrName_RowCommand"
                                    AllowSorting="true" OnSorting="OnSortingGvUserAlias" OnRowDataBound="gvUsrName_RowDataBound" Style="text-align: center" Width="40%">
                                    <HeaderStyle Height="30px" BackColor="#5a99e0" ForeColor="white" BorderWidth="0px" />
                                    <Columns>
                                        <asp:TemplateField HeaderStyle-CssClass="gridHeader" SortExpression="Platform"
                                            HeaderStyle-HorizontalAlign="left" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#5a99e0"
                                            HeaderText="Platform" ItemStyle-BorderWidth="0px" FooterStyle-BorderWidth="0px"
                                            ItemStyle-Height="20px">
                                            <ItemTemplate>
                                                <table width="100px" cellpadding="0px" cellspacing="0px" style="height: 35px">
                                                    <tr>
                                                        <td class="cellStyle" style="padding-left: 20px; text-align: left">
                                                            <asp:Label runat="server" ID="lblUsrNamePlatformName" />
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderStyle-CssClass="gridHeader" SortExpression="Name" HeaderStyle-HorizontalAlign="left"
                                            HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#5a99e0" HeaderText="Alias"
                                            ItemStyle-BorderWidth="0px" FooterStyle-BorderWidth="0px" ItemStyle-Height="20px">
                                            <ItemTemplate>
                                                <table width="250px" cellpadding="0px" cellspacing="0px" style="height: 35px">
                                                    <tr>
                                                        <td class="cellStyle" style="padding-left: 20px; text-align: left">
                                                            <asp:Label runat="server" ID="lblUsrNameGrid" />
                                                            &nbsp;
                                                        </td>                                                    
                                                    </tr>
                                                </table>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderStyle-CssClass="gridHeader" HeaderStyle-HorizontalAlign="left"
                                            HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#5a99e0" HeaderText="Options"
                                            ItemStyle-BorderWidth="0px" FooterStyle-BorderWidth="0px" ItemStyle-Height="20px">
                                            <ItemTemplate>
                                                <table width="65px" cellpadding="0px" cellspacing="0px" style="height: 35px; text-align: center">
                                                    <tr>
                                                        <td class="cellStyle" style="width: 60px;">
                                                            <asp:ImageButton ImageUrl="~/App_Themes/NewDesign/Images/delete-icon.gif" ID="lbtnDelete"
                                                                runat="server" Text="Delete" CommandName="DeleteUsrName" Style="vertical-align: middle">
                                                            </asp:ImageButton>
                                                            <ajaxtoolkit:confirmbuttonextender id="ConfirmButtonExtender1" runat="server" targetcontrolid="lbtnDelete"
                                                                confirmtext="Are you sure you want to delete the Platform User Alias?" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <table width="60px" cellpadding="0px" cellspacing="0px" style="height: 25px; text-align: center">
                                                    <tr>
                                                        <td style="width: 60px;" class="OptionStyle">
                                                            <asp:Label ID="lblDelete" runat="server" Text="Delete" CssClass="OptionText"></asp:Label>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </FooterTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </contentTemplate>
            </asp:Panel>
        
        
        
        <table width="100%">
            <tr>
                <td width="40%">
                </td>
                <td align="center" style="padding-top:7px">                        
                    <asp:Button id="btnSubmit" runat="server" style="background-image:url(App_Themes/NewDesign/Images/btn-SubmitBlue.gif);cursor:pointer" CssClass="Button" Text="SUBMIT" ValidationGroup="CreateUserWizard1" OnClick="CreateUser"/>
                </td>
                <td align="center" style="padding-top:7px">                        
                    <asp:Button id="btnCancel" runat="server" style="background-image:url(App_Themes/NewDesign/Images/btn-SubmitBlue.gif);cursor:pointer" CssClass="Button" Text="CANCEL" OnClick="DoCancel"/>
                </td>
                <td width="40%">
                </td>
            </tr>    
        </table>       
  
      </asp:Panel>
    
    
    
    <ajaxToolkit:CollapsiblePanelExtender ID="CreateUpdateUserPanelExtender" runat="server"
            TargetControlID="pnlCreateUpdateUser"
            CollapsedSize="0"
            Collapsed="False"
            ExpandControlID="lnkBtnCollapseExpand"
            CollapseControlID="lnkBtnCollapseExpand"
            AutoCollapse="False"
            AutoExpand="False"
            ImageControlID="imgCollapseExpand"
            ExpandedImage="~/App_Themes/NewDesign/Images/_icon.gif"
            CollapsedImage="~/App_Themes/NewDesign/Images/+icon.gif"
            ExpandDirection="Vertical" />        
    </contenttemplate>
</asp:UpdatePanel>
